/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.calimeraw.testform.controller;

import com.calimeraw.testform.NameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 * @author Calimeraw93
 */
@Controller
public class HelloNameController {
    
    @Autowired
    public NameService nameService;

    public void setNameService(NameService nameService) {
        this.nameService = nameService;
    }
    
    @RequestMapping(value="/helloView.htm", method=RequestMethod.GET)
    public ModelAndView initHelloView()
    {
        ModelAndView mv = new ModelAndView("helloView");
        mv.addObject("name", nameService.getName());
        return mv;
    }
}
